package cn.wolfcode.trip.app.controller;

import cn.wolfcode.trip.base.service.IStrategyService;
import cn.wolfcode.trip.base.service.ITravelService;
import cn.wolfcode.trip.base.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/searchs")
public class SearchController {
    @Autowired
    private ITravelService travelService;
    @Autowired
    private IUserService userService;
    @Autowired
    private IStrategyService strategyService;
    /**
     * 根据关键字查询总条数
     * @param keyword
     * @return
     */
    @GetMapping("/counts")
    public List getCounts(String keyword){
        List list= new ArrayList<>();
        Map<String,Object> map = travelService.getCounts(keyword);
        Map<String,Object> map1 = userService.getCounts(keyword);
        Map<String,Object> map3 = strategyService.getCounts(keyword);
        list.add(map);
        list.add(map1);
        list.add(map3);
        return list;
    }
}
